package com.wenda.homeschooedu.action;

import java.util.Collection;

import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.springframework.stereotype.Controller;

import com.wenda.homeschooedu.model.Information;
import com.wenda.homeschooedu.service.InformationService;

import cn.wooshai.core.struts2.WooshaiAction;


/**
 * @author ishenli
 *
 */
@Controller("information")
@Results(value = { 
	@Result(name = WooshaiAction.SUCCESS, type = "redirect", location = "information.xhtml"),//采用命名空间，不要admin  struts.xml		
})
public class InformationAction extends BaseAction /*implements PaginationAware */ {

	
	/**
	 * 
	 */
	private static final long serialVersionUID = 8448004754112438171L;
	private Information model;
	private InformationService informationService=new InformationService();
	private Collection<Information> list;
	private Long id;
	
	public String index(){
		list=this.informationService.findAll();
		return INDEX;
	}
	public String editNew(){
		return EDITNEW;
	}
	
	public String create(){
		this.informationService.create(model);
		return SUCCESS;
	}
	public String show(){
		model=this.informationService.findByPrimaryKey(id);
		return SHOW;
	}
	/**
	 * @return the model
	 */
	public Information getModel() {
		return model;
	}
	/**
	 * @param model the model to set
	 */
	public void setModel(Information model) {
		this.model = model;
	}
	/**
	 * @return the informationService
	 */
	public InformationService getInformationService() {
		return informationService;
	}
	/**
	 * @param informationService the informationService to set
	 */
	public void setInformationService(InformationService informationService) {
		this.informationService = informationService;
	}
	/**
	 * @return the list
	 */
	public Collection<Information> getList() {
		return list;
	}
	/**
	 * @param list the list to set
	 */
	public void setList(Collection<Information> list) {
		this.list = list;
	}
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	/*@Override
	public void setPage(int page) {
		this.pm.setPage(page);
	}*/
}
